﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace E1_eMart
{
    public partial class Bid_History : System.Web.UI.Page
    {
        public List<SanPham> listSanPham = new List<SanPham>();
        public TaiKhoan account = new TaiKhoan();
        protected int loaiTaiKhoan = -1;

        protected void Page_Load(object sender, EventArgs e)
        {
            DataClasses1DataContext edata = new DataClasses1DataContext();
            if (Session["username"] == null)
            {
                return;
            }
            account = ((TaiKhoan)Session["username"]);
            loaiTaiKhoan = (int)account.MaLoaiTaiKhoan;
            //var dsSanPham;
            if (Session["username"] == null)
            {
                var dsSanPham1 = from sp in edata.SanPhams
                                 where sp.MaTinhTrangSanPham != 2 & sp.MaTinhTrangSanPham != 1
                                 select sp;
                listSanPham = dsSanPham1.ToList<SanPham>();
                return;
            }
            string tentaikhoan = ((TaiKhoan)Session["username"]).TenTaiKhoan;

            var dsSanPham = from sp in edata.SanPhams
                            where sp.TaiKhoan.TenTaiKhoan == tentaikhoan & sp.MaTinhTrangSanPham != 2 & sp.MaTinhTrangSanPham != 1
                            select sp;
            listSanPham = dsSanPham.ToList<SanPham>();
        }
    }
}